from khronos import Atomic, Action

class Thread(Atomic):
    def __init__(self, target, name=None, parent=None, priority=None):
        Atomic.__init__(self, name, parent, priority)
        self.target = target
        
    def initializer(self):
        if isinstance(self.target, Action):
            return self.target(activation=self.terminate, cancelation=self.terminate)
            
